package FlowGraph.StatementInfo;

import java.lang.reflect.Constructor;

import antlr.collections.AST;

import db.ClassData;
import SymbolTable.*;
import FlowGraph.Nodes.BasicBlockNode;

//////////////////////////////////////////////////////////////////////////
//// VarDefStatementInfo
/**
        Dados sobre um statement de var def.

@author Ivan Jeukens
@version v 0.1 12/06/2002
*/
public class VarDefStatementInfo extends StatementInfo {

    public VarDefStatementInfo(BasicBlockNode node, AST statement) {
        super(node, statement, VARDEF);
        _isNew = false;
    }

    ///////////////////////////////////////////////////////////////////
    ////                        public methods                     //// 

    public void setIsNew(boolean value) {
        _isNew = value;
    }
    
    public boolean isNew() {
        return _isNew;
    }

    public void parseNewStatement(ClassData dbinfo, SymbolTable ports,
            SymbolTable parameters, SymbolTable variables) {
        if(!_isNew) return;
        _newStatementInfo = new NewStatementInfo(this);
        _newStatementInfo.parse(dbinfo, ports, parameters, variables);
    }

    public Constructor getConstructor() {
        return _newStatementInfo.getConstructor();
    }

    ///////////////////////////////////////////////////////////////////
    ////                      private variables                    ////

    private boolean _isNew;
    private NewStatementInfo _newStatementInfo;
}
